package com.al.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class Delete {
	public static void main(String[] args) throws ClassNotFoundException, SQLException {
		Class.forName("com.mysql.cj.jdbc.Driver");
		String url = "jdbc:mysql://localhost:3306/jdbcdemo?serverTimezone=UTC";
		String user = "root";
		String password = "";
		Connection conn = DriverManager.getConnection(url, user, password);
		String sql = "delete from users where id = 4";
		Statement stat = conn.createStatement();
		int i = stat.executeUpdate(sql);
		System.out.println("有"+i+"条记录被执行");
		stat.close();
		conn.close();
	}
}
